﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.Data
{
    [Serializable]
   public class Grid2dCollecion
    {
        public Grid2dCollecion()
        {
            this.Grid2d = new List<Grid2d>();
        }

        private List<Grid2d> _Grid2d;

        public List<Grid2d> Grid2d
        {
            get { return _Grid2d; }
            set { _Grid2d = value; }
        }

        [field: NonSerialized]
        public event EventHandler<CollecionChangedEventArgs> CollectionChanged;

        public void Add(Grid2d data)
        {
            this.Grid2d.Add(data);

            if (this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.ADD));

            }

        }

        public void Remove(Grid2d data)
        {
            if (this.Grid2d.Contains(data))
            {
                this.Grid2d.Remove(data);
                if (this.CollectionChanged != null)
                {
                    this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.REMOVE));
                }
            }
        }
    }
}
